#ifndef PROTREEWIDGET_H
#define PROTREEWIDGET_H

#include<QTreeWidget>
#include<QSet>
#include<QAction>
#include<QProgressDialog>
#include"protreethread.h"
#include<memory>
#include"opentreethread.h"
#include<QtMultimedia/QMediaPlayer>
#include<QtMultimedia/QMediaPlaylist>
class SlideShowDialog;

class ProTreeWidget : public QTreeWidget
{
    Q_OBJECT
public:
    ProTreeWidget(QWidget *parent = Q_NULLPTR);
    void AddProToTree(const QString name, const QString path);
private:
    QSet<QString> _set_path;
//    右键item后弹出的某个菜单, 一般开发的时候可以尽量把一些点击到的东西保存下来，就算后面不使用也没关系
    QTreeWidgetItem *_right_btn_item;
    QTreeWidgetItem *_active_item;
    QTreeWidgetItem *_selected_item;
    QAction *_action_import;
    QAction *_action_setstart;
    QAction *_action_closepro;
    QAction *_action_slideshow;
    QProgressDialog *_dialog_progress;
    std::shared_ptr<ProTreeThread> _thread_create_pro;
    std::shared_ptr<OpenTreeThread> _thread_open_pro;
    std::shared_ptr<SlideShowDialog> _slide_show_dialog;
    std::shared_ptr<QMediaPlayer> _player;
    std::shared_ptr<QMediaPlaylist> _playlist;
public slots:
    void SlotOpenPro(const QString path);
    void SlotNextShow();
    void SlotPreShow();
    void SlotSetMusic(bool);
    void SlotStartMusic();
    void SlotStopMusic();
private slots:
//    鼠标按键条目时触发
    void SlotItemPressed(QTreeWidgetItem *item, int column);
    void SlotImport();
    void SlotSetActive();
    void SlotClosePro();
    void SlotDoubleClickItem(QTreeWidgetItem *item, int column);
    void SlotUpdateProgress(int count);
    void SlotFinishProgress();
    void SlotCancleProgress();
    void SlotSlideShow();
signals:
    void SigCancelProgress();
    void SigUpdateSelected(const QString&);
    void SigUpdatePic(const QString&);
    void SigClearSelected();
};

#endif // PROTREEWIDGET_H
